home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
eflibpt4.zip
/
DEMO
/
STRINGS
/
PARSEXPR.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-08-09
|
957b
|
29 lines
{ Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
Demonstration; parsing expression using the string parser object
EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED. }
uses EFLIBDEF, EFLIBINI, EFLIBTXT;
var Expression : ParserObjectType; SomeExpression : string; Index : word;
begin
SomeExpression := '12*4-(1+2)/7';
with Expression do begin
Initialize (@SomeExpression, { Address of string resource }
['+', '-', '*', '/', '(', ')']); { Separators }
{ Separate tokens out of string }
for Index := 1 to Tokens do
Write ('*', Token (Index), '* ');
WriteLn;
Intercept; { Intercept (dispose separator allocation) }
end;
end.